﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace DDD4Fun.Ducks
{
    public interface Iterator<T>
    {
        bool HasNext();
        T Next();
    }

    public class DuckyIterator<T> : Iterator<T>
    {
        IEnumerator enumerator;
        public DuckyIterator(IList<T> list)
        {
            this.enumerator = list.GetEnumerator() ;
        }

        #region Iterator Members

        public bool HasNext()
        {
            return enumerator.MoveNext();
        }

        public T Next()
        {
            return (T)enumerator.Current;
        }

        #endregion
    }

}
